import hashlib
import sys

def calculate_credential(password, challenge):
    # 将密码和challenge拼接
    input_str = password + challenge
    # 计算SHA256哈希
    sha256_hash = hashlib.sha256(input_str.encode('utf-8')).hexdigest()
    return sha256_hash

if __name__ == "__main__":
    if len(sys.argv) != 3:
        print("使用方法: python sha256.py <password> <challenge>")
        print("示例: python sha256.py admin123 abcdef123456")
        sys.exit(1)
    
    password = sys.argv[1]
    challenge = sys.argv[2]
    
    credential = calculate_credential(password, challenge)
    print(f"Password: {password}")
    print(f"Challenge: {challenge}")
    print(f"Credential: {credential}")